{"ast":null,"code":"import mime from \"mime\";\nimport { getUserName } from \"./User\";\nexport const isMe = (user, store) => {\n  return store.getProfile().id === user.id;\n};\nexport const checkRead = read => {\n  return read.items && read.items.length > 0;\n};\nexport const checkMimeType = (content, type) => {\n  var _mime$getType;\n  return !!(content.link && (_mime$getType = mime.getType(content.link)) !== null && _mime$getType !== void 0 && _mime$getType.includes(type));\n};\nexport const getHelloMessage = store => {\n  const contentList = {\n    items: []\n  };\n  const replyMessage = {\n    items: []\n  };\n  const helloMessageItem = {\n    message: `${getUserName(store.getProfile())}, напишите сообщение, чтобы начать общаться!`,\n    replyMessage: replyMessage,\n    content: contentList\n  };\n  return {\n    id: Math.floor(Math.random() * 9999),\n    user: store.getProfile(),\n    read: {\n      items: []\n    },\n    reply: {\n      items: []\n    },\n    body_message: helloMessageItem,\n    created_at: 0,\n    updated_at: null\n  };\n};","map":{"version":3,"names":["mime","getUserName","isMe","user","store","getProfile","id","checkRead","read","items","length","checkMimeType","content","type","link","getType","includes","getHelloMessage","contentList","replyMessage","helloMessageItem","message","Math","floor","random","reply","body_message","created_at","updated_at"],"sources":["/data/messenger.client/src/utils/Message.ts"],"sourcesContent":["import {UserListItem} from \"../models/response/UserListItem\";\nimport Store from \"../store/store\";\nimport {ReadMessageListResponse} from \"../models/response/ReadMessageListResponse\";\nimport {ContentListItem} from \"../models/response/ContentListItem\";\nimport mime from \"mime\";\nimport {MessagesListItem} from \"../models/response/MessagesListItem\";\nimport {MessageItem} from \"../models/response/MessageItem\";\nimport {ContentListResponse} from \"../models/response/ContentListResponse\";\nimport {MessagesShortListResponse} from \"../models/response/MessagesShortListResponse\";\nimport {getUserName} from \"./User\";\n\nexport const isMe = (user: UserListItem, store: Store): boolean => {\n    return store.getProfile().id === user.id;\n}\n\nexport const checkRead = (read: ReadMessageListResponse): boolean => {\n    return read.items && read.items.length > 0;\n}\n\nexport const checkMimeType = (content: ContentListItem, type:string): boolean => {\n    return !!(content.link && mime.getType(content.link)?.includes(type));\n}\n\nexport const getHelloMessage = (store: Store): MessagesListItem => {\n    const contentList: ContentListResponse = {\n        items:[]\n    };\n    const replyMessage: MessagesShortListResponse = {\n        items:[]\n    };\n    const helloMessageItem: MessageItem = {\n        message: `${getUserName(store.getProfile())}, напишите сообщение, чтобы начать общаться!`,\n        replyMessage: replyMessage,\n        content: contentList\n    };\n\n    return (\n        {\n            id: Math.floor(Math.random() * 9999),\n            user: store.getProfile(),\n            read: {items: []},\n            reply: {items:[]},\n            body_message: helloMessageItem,\n            created_at: 0,\n            updated_at: null\n        });\n}"],"mappings":"AAIA,OAAOA,IAAI,MAAM,MAAM;AAKvB,SAAQC,WAAW,QAAO,QAAQ;AAElC,OAAO,MAAMC,IAAI,GAAG,CAACC,IAAkB,EAAEC,KAAY,KAAc;EAC/D,OAAOA,KAAK,CAACC,UAAU,EAAE,CAACC,EAAE,KAAKH,IAAI,CAACG,EAAE;AAC5C,CAAC;AAED,OAAO,MAAMC,SAAS,GAAIC,IAA6B,IAAc;EACjE,OAAOA,IAAI,CAACC,KAAK,IAAID,IAAI,CAACC,KAAK,CAACC,MAAM,GAAG,CAAC;AAC9C,CAAC;AAED,OAAO,MAAMC,aAAa,GAAG,CAACC,OAAwB,EAAEC,IAAW,KAAc;EAAA;EAC7E,OAAO,CAAC,EAAED,OAAO,CAACE,IAAI,qBAAId,IAAI,CAACe,OAAO,CAACH,OAAO,CAACE,IAAI,CAAC,0CAA1B,cAA4BE,QAAQ,CAACH,IAAI,CAAC,CAAC;AACzE,CAAC;AAED,OAAO,MAAMI,eAAe,GAAIb,KAAY,IAAuB;EAC/D,MAAMc,WAAgC,GAAG;IACrCT,KAAK,EAAC;EACV,CAAC;EACD,MAAMU,YAAuC,GAAG;IAC5CV,KAAK,EAAC;EACV,CAAC;EACD,MAAMW,gBAA6B,GAAG;IAClCC,OAAO,EAAG,GAAEpB,WAAW,CAACG,KAAK,CAACC,UAAU,EAAE,CAAE,8CAA6C;IACzFc,YAAY,EAAEA,YAAY;IAC1BP,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